export interface Error {
    error: string;
}

export interface TokenReturn {
    token: string;
}

interface UserDetail {
    userId: number;
    name: string;
    email: string;
    numSuccessfulLogins: number;
    numFailedPasswordsSinceLastLogin: number;
}
  
export interface UserReturn {
    user: UserDetail;
}

interface QuizInfo {
    quizId: number;
    name: string;
}

export interface QuizList {
    quizzes: QuizInfo[];
}

export interface users {
    userID: number;
    QuizID: number[];
    FirstName: string;
    LastName: string;
    email: string;
    password: string;
    usedPasswords: string[];
    numSuccessfulLogins: number;
    numFailedPasswordsSinceLastLogin:number
}
export interface Session {
    Messages: any[];
    QuizID: number;
    SessionID: number;
    State: 'FINAL_RESULTS'| 'ACTIVE' | 'END' | 'LOBBY' | 'QUESTION_COUNTDOWN' | "QUESTION_OPEN" | "ANSWER_SHOW";
    StartTime: Date;
    EndTime?: Date;
    Results?: Array<{ playerId: number, score: number ,State : string}>; 
    players: Player[];
}


export interface quizzes {
    Questions: any;
    timeLastEdited: Date;
    QuizID: number;
    AuthorID: number[];
    Name: string;
    TimeCreated: Date;
    TimeLastEdited: Date;
    Description: string;
    State: string;
    thumbnailUrl?: string;
    Sessions: Session[];
}

export interface Questions{
    question: string;
    questionId: number;
    duration: number;
    points: number;
    answers: [
    {
        answer: string;
        correct: boolean
    }
    ]
}
export interface Tokens {
    [x: string]: any;
    [userId: number]: string[];
}

export interface Data {
    users: users[];
    quizzes: quizzes[];
    Tokens: Tokens;
    sessions: Session[];//登录状态
    players: Player[];
}

interface Player {
    playerId: number;
    name: string;
    sessionId: number;
    score: number;
}
export interface Success {
    message: string;
}

export interface QuizId {
    quizId: number;
}
export interface QuestionInput {
    question: string;
    duration: number;
    points: number;
    answers: { answer: string; correct: boolean }[];
  }